/*
** Copyright (C) 2009 Joshua Brent Marsh <joshua@icub3d.com>
**  
** This file is part of icub3d-adt
**
** icub3d-adt is free sofware; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 3 of the License, or
** (at your option) any later version.
**  
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**  
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**  
*/

/* $Id: function_prototypes.h 53 2009-12-24 20:43:05Z joshua@icub3d.com $ */

#ifndef ICUB3D_FUNCTION_PROTOTYPES
#define ICUB3D_FUNCTION_PROTOTYPES 1

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <unistd.h>

/* Prototypes used by the library. */
typedef int (comp_func) (const void *, const void *);
typedef void (destroy_func) (void *);
typedef void * (copy_func) (const void *);

/* These are functions used by the library for primitive data types. */

void *copy_int8_t (const void *b);
int comp_int8_t (const void *a, const void *b);
void dest_int8_t (void *a);

void *copy_int16_t (const void *b);
int comp_int16_t (const void *a, const void *b);
void dest_int16_t (void *a);

void *copy_int32_t (const void *b);
int comp_int32_t (const void *a, const void *b);
void dest_int32_t (void *a);

void *copy_int64_t (const void *b);
int comp_int64_t (const void *a, const void *b);
void dest_int64_t (void *a);

void *copy_uint8_t (const void *b);
int comp_uint8_t (const void *a, const void *b);
void dest_uint8_t (void *a);

void *copy_uint16_t (const void *b);
int comp_uint16_t (const void *a, const void *b);
void dest_uint16_t (void *a);

void *copy_uint32_t (const void *b);
int comp_uint32_t (const void *a, const void *b);
void dest_uint32_t (void *a);

void *copy_uint64_t (const void *b);
int comp_uint64_t (const void *a, const void *b);
void dest_uint64_t (void *a);

#define copy_int copy_int32_t
#define comp_int comp_int32_t
#define dest_int dest_int32_t
#define deserialize_int deserialize_int32_t
#define serialize_int serialize_int32_t

void * copy_char (const void *b);
int comp_char (const void *a, const void *b);
void dest_char (void *a);

void * copy_float (const void *b);
int comp_float (const void *a, const void *b);
void dest_float (void *a);

void * copy_double (const void *b);
int comp_double (const void *a, const void *b);
void dest_double (void *a);

void * copy_long_double (const void *b);
int comp_long_double (const void *a, const void *b);
void dest_long_double (void *a);

void * copy_string (const void *b);
int comp_string (const void *a, const void *b);
void dest_string (void *a);

/* A pair whose id is an integer. */
typedef
struct size_t_string_pair
{
  size_t id;
  char *value;
} ISPair;

ISPair * create_ispair (const size_t id, const char *value);
void * copy_ispair (const void *b);
int comp_ispair (const void *a, const void *b);
void dest_ispair (void *a);

/* A pair whose id is an string. */
typedef
struct string_string_pair
{
  char *name;
  char *value;
} SSPair;

SSPair * create_sspair (const char *name, const char *value);
void * copy_sspair (const void *b);
int comp_sspair (const void *a, const void *b);
void dest_sspair (void *a);

#endif /* ICUB3D_FUNCTION_PROTOTYPES */
